package com.sharp.schedule.dao.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Table;
import java.util.Date;

/**
 * Title: SaScheduleHistory
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2020/10/21 18:06
 */

/**
 * 定时任务运行结果
 */
@ApiModel(value = "com-srct-service-schedule-dao-entity-SaScheduleHistory")
@Data
@Table(name = "sa_schedule_history")
public class SaScheduleHistory {
    @Id
    @Column(name = "id")
    @GeneratedValue(generator = "JDBC")
    @ApiModelProperty(value = "")
    private Integer id;

    @Column(name = "schedule_id")
    @ApiModelProperty(value = "")
    private Integer scheduleId;

    /**
     * 定时任务名
     */
    @Column(name = "job_name")
    @ApiModelProperty(value = "定时任务名")
    private String jobName;

    /**
     * 0:单次,1:cron,2:结束间隔周期,3:开始间隔周期
     */
    @Column(name = "`type`")
    @ApiModelProperty(value = "0:单次,1:cron,2:结束间隔周期,3:开始间隔周期")
    private String type;

    /**
     * 定时任务表达式(type = 1)
     */
    @Column(name = "cron")
    @ApiModelProperty(value = "定时任务表达式(type = 1)")
    private String cron;

    /**
     * 起始时间
     */
    @Column(name = "start_time")
    @ApiModelProperty(value = "起始时间")
    private Date startTime;

    /**
     * 周期间隔时间(type=2 or 3)
     */
    @Column(name = "period")
    @ApiModelProperty(value = "周期间隔时间(type=2 or 3)")
    private Integer period;

    /**
     * 服务
     */
    @Column(name = "service")
    @ApiModelProperty(value = "服务")
    private String service;

    /**
     * 方法
     */
    @Column(name = "`function`")
    @ApiModelProperty(value = "方法")
    private String function;

    /**
     * 参数
     */
    @Column(name = "`parameter`")
    @ApiModelProperty(value = "参数")
    private String parameter;

    @Column(name = "run_at")
    @ApiModelProperty(value = "")
    private Date runAt;

    @Column(name = "finish_at")
    @ApiModelProperty(value = "")
    private Date finishAt;

    @Column(name = "`result`")
    @ApiModelProperty(value = "")
    private String result;
}
